<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <script src="../build/react.development.js"></script>
    <script src="../build/react-dom.development.js"></script>
    <script src="../build/babel.min.js"></script>
  </head>
  <body>
    <div id="example"></div>
    <style type="text/css">
      .ta {
        background-color:   #bababa;
        cursor: pointer;
      }
      .tb{
        background-color:  #e88f8f;
        cursor: pointer;
      }
    </style>
    <script type="text/babel">
      class LikeButton extends React.Component {
        state = {
            liked: false,
            styles:{
              "true":"ta",
              "false":"tb"
            }
        }

        constructor(props) {
          super(props)
          
          this.handleClick = this.handleClick.bind(this)
        }
        handleClick(event,...args) {
          console.log(args[0])
          console.log(args[1])
          this.setState({ liked: !this.state.liked });
        }
        render() {
          var text = ""
          if (this.state.liked) {text=  'like'} else{ text='haven\'t liked'};
          return (
            <div onClick={(ev)=>this.handleClick(ev,9527,1024)} className={this.state.styles[this.state.liked]}>
              You {text} this. Click to toggle.
            </div>
          );
        }
      }

      ReactDOM.render(
        <LikeButton />,
        document.getElementById('example')
      );
    </script>
  </body>
</html>

